<template>
  <div class="page-root">
    <el-pagination
      v-model:current-page="pageNoRef"
      v-model:page-size="pageSizeRef"
      :page-sizes="[10, 20, 30]"
      size="small"
      layout="total, sizes, prev, pager, next, jumper"
      :total="total"
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
    />
  </div>
</template>

<script lang="ts" setup>
import { ref } from 'vue'

defineProps(['total'])
const $emit = defineEmits(['changeSize', 'changeCurrent'])

const pageNoRef = ref(1)
const pageSizeRef = ref(10)

const handleSizeChange = (val: number) => {
  $emit('changeSize', val)
}
const handleCurrentChange = (val: number) => {
  $emit('changeCurrent', val)
}
</script>

<style lang="scss" scoped>
.page-root {
  display: flex;
  justify-content: flex-end;
  height: 60px;
}
</style>
